﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public abstract class AbstractAction<THandledEventType,TDispatchedEventType> {
	public string name;

	public AbstractAction ()
	{

	}

	//Run on all actions for a given event before any of them are executed so that they are capable of collecting relevant pre-execution data.
	//Models should not be modified in this method, only read.
	//The actionParams Hashtable is used to pass data between multiple actions which occur in response to a single event.
	public abstract bool Init (AbstractActionEventStaticData eventStatic , ActionEvent<THandledEventType> eventState , Hashtable actionParams);

	//Tests the current state and returns whether the action can be successfully executed. If any one action in an event fails, the entire event and all subsequent events must be aborted.
	public abstract bool Test ();

	//The action is executed, modifying models when appropriate.
	public abstract bool Execute (List<ActionEvent<TDispatchedEventType>> newEvents);
	
	//Adds any events that should occur after events from simultaneous actions.
	public abstract bool Finish (List<ActionEvent<TDispatchedEventType>> newEvents);

	//Cleans up the action object and prepares it to be executed again.
	public abstract void Recycle ();
}
